package com.cwt_taxi_xa.util;

import java.io.File;

import it.sauronsoftware.ftp4j.FTPClient;
import it.sauronsoftware.ftp4j.FTPDataTransferListener;

public class FTPUtils {
    public static void upLoadFile(final File zipFile){
        new Thread(new Runnable() {
            @Override
            public void run() {
                FTPClient client = new FTPClient();
                try {
                    client.connect("2873e03b60.qicp.vip", 22221);//其中Host为Ftp地址，端口为固定的21
                    client.login("cwtftp", "1q2w3e");
                    client.upload(zipFile, new FTPDataTransferListener() {
                        @Override
                        public void started() {
                            AppLog.d("开始上传");
                        }

                        @Override
                        public void transferred(int i) {
                            AppLog.d("上传中" + i);
                        }

                        @Override
                        public void completed() {
                            AppLog.d("上传完成");
                        }

                        @Override
                        public void aborted() {

                        }

                        @Override
                        public void failed() {
                            AppLog.d("上传失败");
                        }
                    });


                } catch (Exception e) {
                    e.printStackTrace();

                }
            }
        }).start();
    }
}
